<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <h1>读值</h1>

    <button onclick="setcookie()">setcookie</button>

    <script>
      console.log(document.cookie);

      function setcookie() {
        const et1 = new Date("2023-8-10").toUTCString();
        console.log(et1);
        document.cookie = `name=jack;expires=${et1}`;
      }
    </script>
  </body>
</html>
